<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>药材详情 - ${medicine.medicineName}</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: "Microsoft YaHei", Arial, sans-serif;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            min-height: 100vh;
            padding: 20px;
        }

        .container {
            max-width: 1000px;
            margin: 0 auto;
            background: white;
            border-radius: 10px;
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
            padding: 30px;
        }

        .header {
            text-align: center;
            margin-bottom: 30px;
            padding-bottom: 20px;
            border-bottom: 2px solid #667eea;
        }

        .header h1 {
            color: #333;
            font-size: 32px;
            margin-bottom: 10px;
        }

        .medicine-no {
            color: #667eea;
            font-size: 18px;
            font-weight: bold;
        }

        .detail-card {
            background: #f8f9fa;
            border-radius: 8px;
            padding: 25px;
            margin-bottom: 20px;
        }

        .detail-row {
            display: flex;
            padding: 15px 0;
            border-bottom: 1px solid #e0e0e0;
        }

        .detail-row:last-child {
            border-bottom: none;
        }

        .detail-label {
            font-weight: bold;
            color: #555;
            width: 150px;
            flex-shrink: 0;
        }

        .detail-value {
            color: #333;
            flex: 1;
            line-height: 1.6;
        }

        .detail-value.long-text {
            white-space: pre-wrap;
            word-wrap: break-word;
        }

        .btn {
            display: inline-block;
            padding: 10px 20px;
            background: #667eea;
            color: white;
            text-decoration: none;
            border-radius: 5px;
            transition: background 0.3s;
            margin: 5px;
            border: none;
            cursor: pointer;
            font-size: 14px;
        }

        .btn:hover {
            background: #5568d3;
        }

        .btn-success {
            background: #27ae60;
        }

        .btn-success:hover {
            background: #229954;
        }

        .btn-secondary {
            background: #95a5a6;
        }

        .btn-secondary:hover {
            background: #7f8c8d;
        }

        .action-buttons {
            text-align: center;
            margin-top: 30px;
            padding-top: 20px;
            border-top: 1px solid #e0e0e0;
        }

        .section-title {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            padding: 10px 15px;
            border-radius: 5px;
            margin-bottom: 15px;
            font-size: 16px;
        }

        .timestamp {
            color: #999;
            font-size: 13px;
        }
    </style>
</head>
<body>
    <div class="container">
        <div class="header">
            <h1>🌿 ${medicine.medicineName}</h1>
            <span class="medicine-no">编号：${medicine.medicineNo}</span>
        </div>

        <div class="section-title">📋 基本信息</div>
        <div class="detail-card">
            <div class="detail-row">
                <div class="detail-label">记录ID：</div>
                <div class="detail-value">${medicine.id}</div>
            </div>
            <div class="detail-row">
                <div class="detail-label">药材编号：</div>
                <div class="detail-value"><strong>${medicine.medicineNo}</strong></div>
            </div>
            <div class="detail-row">
                <div class="detail-label">中药名：</div>
                <div class="detail-value"><strong style="font-size: 18px; color: #667eea;">${medicine.medicineName}</strong></div>
            </div>
            <div class="detail-row">
                <div class="detail-label">别名：</div>
                <div class="detail-value">${medicine.alias}</div>
            </div>
        </div>

        <div class="section-title">🌱 来源与分布</div>
        <div class="detail-card">
            <div class="detail-row">
                <div class="detail-label">来源：</div>
                <div class="detail-value long-text">${medicine.source}</div>
            </div>
            <div class="detail-row">
                <div class="detail-label">生长环境分布：</div>
                <div class="detail-value long-text">${medicine.environment}</div>
            </div>
        </div>

        <div class="section-title">💊 药性与功效</div>
        <div class="detail-card">
            <div class="detail-row">
                <div class="detail-label">性味：</div>
                <div class="detail-value">${medicine.natureFlavor}</div>
            </div>
            <div class="detail-row">
                <div class="detail-label">主治功能：</div>
                <div class="detail-value long-text">${medicine.mainFunction}</div>
            </div>
            <div class="detail-row">
                <div class="detail-label">用法用量：</div>
                <div class="detail-value long-text">${medicine.usageDosage}</div>
            </div>
        </div>

        <div class="section-title">⏰ 时间信息</div>
        <div class="detail-card">
            <div class="detail-row">
                <div class="detail-label">创建时间：</div>
                <div class="detail-value timestamp">
                    <fmt:formatDate value="${medicine.createTime}" pattern="yyyy-MM-dd HH:mm:ss"/>
                </div>
            </div>
            <div class="detail-row">
                <div class="detail-label">更新时间：</div>
                <div class="detail-value timestamp">
                    <fmt:formatDate value="${medicine.updateTime}" pattern="yyyy-MM-dd HH:mm:ss"/>
                </div>
            </div>
        </div>

        <div class="action-buttons">
            <a href="${pageContext.request.contextPath}/medicine?action=edit&id=${medicine.id}" 
               class="btn btn-success">✏️ 修改信息</a>
            <a href="${pageContext.request.contextPath}/medicine?action=list" 
               class="btn btn-secondary">← 返回列表</a>
        </div>
    </div>
</body>
</html>

